'use strict';

const Queue = require('./app/commons/Queue');
const KafKaInstance = require('./app/util/kafkaUtil.js');
class AppBootHook {
    constructor(app) {
        this.app = app;
    }


    async serverDidReady() {
        // 将审核队列挂到App上
        this.app.ExamineQueue = new Queue();
        // kafka连接
        const {
            brokers
        } = this.app.config.kafka;
        // 将kafka实例挂到app上
        this.app.kafka = new KafKaInstance(brokers);
        await this.app.kafka.producer('myTopic', 'myGroup', JSON.stringify({
            name: 'eggsy'
        }));
    }
}

module.exports = AppBootHook;